Method, system, and program for prefetching data into cache

ABSTRACT

Provided are a method, system and program for prefetching data into cache. A prefetch command is processed that indicates at least one conditional statement and at least one block to prefetch from storage to cache in response to determining that the conditional statement is satisfied.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to a method, system, and program forprefetching data into cache.

2. Description of the Related Art

Data prefetching techniques are used to prefetch data from anon-volatile storage device, such as one or more hard disk drives, to ahigh speed memory, such as a volatile memory device referred to as acache, in anticipation of future data requests. The data requests maythen be serviced from the high speed cache instead of the storage devicewhich takes longer to access. In this way, data may be returned to therequesting device faster.

During a sequential read operation, an application program, such as abatch program, will process numerous data records stored at contiguouslocations in the storage device. It is desirable during such sequentialread operations to prefetch the sequential data into cache inanticipation of the requests from the application program. Presenttechniques used to prefetch sequential blocks of data include sequentialcaching algorithms systems, such as those described in the commonlyassigned patent entitled “CACHE DASD Sequential Staging and Method,”having U.S. Pat. No. 5,426,76. A sequential caching algorithm detectswhen a device is requesting data as part of a sequential accessoperation. Upon making such a detection, the storage controller willbegin prefetching sequential data records following the last requesteddata record into cache in anticipation of future sequential accesses.The cached records may then be returned to the application performingthe sequential data operations at speeds substantially faster thanretrieving the records from a non-volatile storage device.

Another prefetching technique includes specifying a block of contiguousdata records to prefetch into cache in anticipation of a sequential datarequest. For instance, the Small Computer System Interface (SCSI)provides a prefetch command, PRE-FETCH, that specifies a logical blockaddress where the prefetching operation begins and a transfer length ofcontiguous logical blocks of data to transfer to cache. The SCSIPRE-FETCH command is described in the publication “InformationTechnology-SCSI Block Commands-2 (SBC-2)”, published by ANSI on Jan. 25,2004, reference no. ISO/IEC 14776-322:200, Rev. 12, which publication isincorporated herein by reference in its entirety.

U.S. Pat. No. 6,449,697 describes a technique for prefetchingnon-contiguous blocks of data by submitting a data structure with theprefetch command specifying the non-contiguous data blocks to prefetch.

SUMMARY

Provided are a method, system and program for prefetching data intocache. A prefetch command is processed that indicates at least oneconditional statement and at least one block to prefetch from storage tocache in response to determining that the conditional statement issatisfied.

BRIEF DESCRIPTION OF THE DRAWINGS

Referring now to the drawings in which like reference numbers representcorresponding parts throughout:

FIG. 1 illustrates a computing environment in which embodiments areimplemented;

FIGS. 2, 5, and 6 illustrate conditional prefetch commands in accordancewith embodiments; and

FIGS. 3, 4, and 7 illustrate operations to generate and process aconditional prefetch command in accordance with embodiments.

DETAILED DESCRIPTION

In the following description, reference is made to the accompanyingdrawings which form a part hereof and which illustrate severalembodiments of the present invention. It is understood that otherembodiments may be utilized and structural and operational changes maybe made without departing from the scope of the present invention.

FIG. 1 illustrates a computing environment in which aspects of theinvention are implemented. One or more hosts 2 (only one is shown)communicate Input/Output (I/O) requests to a storage system 4 through astorage controller 6. The host 2 may communicate with the storagecontroller 6 via a network, such as a Local Area Network (LAN), StorageArea Network (SAN), Wide Area Network (WAN), wireless network, etc.Alternatively, the host 2 may communicate with the storage controller 6over a bus interface, such as a Peripheral Component Interconnect (PCI)bus. The host 2, storage system 8, and storage controller 6 may behoused in separate machines or be included in the same machineconnecting via one or more bus interfaces. The storage controller 6 maycomprise any storage management system known in the art, such as astorage controller, server, enterprise storage server, etc. The storagesystem 4 may comprise any storage system known in the art, such as aDirect Access Storage Device (DASD), Just a Bunch of Disks (JBOD), aRedundant Array of Independent Disks (RAID), virtualization device, tapestorage, optical disk storage, or any other storage system known in theart. The host 2 may comprise any computing device known in the art, suchas a workstation, desktop computer, server, mainframe, handheldcomputer, telephony device, etc. The host 2 includes an applicationprogram 12 that generates I/O requests.

The storage controller 6 includes a processor 8 and a cache 10. Thecache 10 is comprised of one or more volatile memory devices. Thestorage controller 6 stages data blocks into the cache 10 retrieved fromthe storage system 4 in anticipation of subsequent requests for thedata. A “data block” comprises any known accessible unit of data knownin the art, such as a byte at a Logical Block Address (LBA), a track, afraction of a byte, etc. The host 2 and storage controller 6 include I/Olayers 14 a, 14 b that comprise the code to process I/O commands. TheI/O layer 14 a, 14 b may comprise a driver program implementing an I/Oprotocol, such as a Small Computer System Interface (SCSI) driver,Internet SCSI (iSCSI) driver, or any other protocol driver for handlingI/O requests. Alternatively, the I/O layers 14 a, 14 b may comprise aclient/server storage management or database program, where suchclient/server program is used to generate, communicate, and process I/Orequests.

In described embodiments, the application program 12 generatesconditional prefetch requests to cause the storage controller 6 toprefetch data depending on different conditions. FIG. 2 illustrates anexample of a format of a prefetch command 20 that the applicationprogram 12 generates through the I/O layer 14 b. The prefetch command 20includes one or more conditional statements 22 and a duration parameter24 providing some limitation on the duration the conditional prefetchcommand 20 remains effective. For instance, the duration parameter 24may specify a time during which the conditional prefetch command 20remains in effect or provide some condition that causes the conditionalprefetch command 20 to terminate at the storage controller 6, such asthe access of a particular section of data in the storage system 4,session termination, time expiration, etc. Alternatively, the storagecontroller 6 and I/O layer 14 a may maintain independent rules for theduration of the conditional prefetch command 20. The conditionalstatements 22 include a condition 26 specifying a conditional event. Ifthe conditional event in condition 26 occurs, then the correspondingblocks indicated in the blocks to prefetch 28 are prefetched from thestorage system 4 into the cache 10. In certain embodiments, thecondition 26 comprises an access to one or more blocks, and thesatisfaction of this condition 26, i.e., access to the specified blocksin the storage system 4 causes the prefetch of the specified blocks 28.The blocks to prefetch indicated in the blocks to prefetch 28 field maybe contiguous or non-contiguous. In certain embodiments, the condition26 may specify whether the access is a read or write, so the prefetch isonly performed in a response to the specified read or write to the blockspecified in the condition 26.

Below is pseudo-code providing an example of the conditional statements22 that may be included in a conditional prefetch command 20:

-   -   If Block to read 23, then Prefetch blocks 25, 27, 28, 29, 30, 31    -   If Block to read 56, then Prefetch blocks 57, 58, 59, 60, 61, 62    -   If Block to read 123, then Prefetch blocks 212, 234.

FIG. 3 illustrates operations performed in the host 2 to generate andtransmit a conditional prefetch command 20 (FIG. 2). At block 50, theapplication program 12 generates one or more conditional statements toprefetch blocks if a certain condition is satisfied, such as an accessto a specified block. The application program 12 may implement apredictive analysis program to determine the blocks users will likelyaccess if they access a specific one or more blocks. The predictiveanalysis component of (or external to) the application program 12 maycollect statistics on user access patterns to determine the likelyblocks a user will access in the future depending on a currentlyaccessed block to anticipate user access patterns. The I/O layer 14 bprocesses conditional statements from the application program 12 andgenerates (at block 52) a prefetch command 20 including conditionalstatements 22 and a duration 24 that is transferred (at block 54) to thestorage controller 6. In alternative embodiments, the applicationprogram 12 may generate the conditional statement 20 itself and forwardto the storage controller 6. After transmitting a conditional prefetchcommand 20, the I/O layer 14 b (or application program 12) may submit(at block 56) I/O requests to the storage controller 6 to access, i.e.,read or write, data in the storage system 4.

FIG. 4 illustrates operations the processor 8 of the storage controller6 performs when executing code in the I/O layer 14 a or some otherprogram component accessible to the processor 8 to process a conditionalprefetch command 20. Upon receiving (at block 100) a conditionalprefetch command 20, the processor 8 buffers such received command 20for later consideration. Subsequently, upon receiving (at block 102) anI/O request from the host 2 directed to the storage system 4, theprocessor 8 determines (at block 104) unexpired conditional prefetchcommands 20, i.e., those commands 20 having a duration 24 that has notexpired. This determination may be made by considering the durationparameter 24 provided with received conditional prefetch commands 20 anddetermining whether according to such parameter 24 the conditionalprefetch command 20 has expired. Alternatively, the processor 8 may haveits own parameters and technique for determining whether a prefetchcommand 20 has expired independent of the host 2. As mentioned, theduration may be determined by a timer, session, etc. If (at block 106)there are one or more unexpired conditional prefetch commands 20 and if(at block 108) the I/O request is to a block satisfying a condition 26in one or more determined unexpired conditional prefetch commands 20 andif (at block 110) the blocks indicated in the blocks to prefetch 28 arenot already in cache, then the processor 8 prefetches (at block 112) theblocks indicated in the blocks to prefetch 28 field associated with thesatisfied condition(s) 26 that are not already in cache 10. Otherwise,if either there is not one or more unexpired conditional prefetchcommands 20 (at block 106) or if (at block 108) the I/O request is notto a block satisfying a condition 26 in one or more determined unexpiredconditional prefetch commands 20 or if (at block 110) the blocksindicated in the blocks to prefetch 28 are already in the cache 10, thencontrol proceeds back to block 102 to wait to process further I/Orequests from the host 2.

FIGS. 5 and 6 illustrate an additional embodiment of the conditionalprefetch command. FIG. 5 illustrates a prefetch command 200 that the I/Olayer 14 b may generate and submit. The prefetch command 200 may includeone or more standard prefetch fields, e.g., 202 a and 202 c, to prefetchone or more blocks from storage. The prefetch command 200 may alsooptionally include one or more conditional prefetch statements 202 b,where the conditional prefetch statements may be interspersed with thestandard prefetch statements. FIG. 6 illustrates information that may beincluded in the conditional prefetch statement 202 b.

With respect to FIG. 6, the conditional prefetch statement 202 bincludes a duration 210, which is used in a similar manner to theduration parameter 24 described above to place a temporal limit on theduration during which the conditional prefetch statement 202 b remainsin effect. The conditional prefetch statement 202 b further includes oneor more branches, where each branch is comprised of a branch identifier(ID) block, e.g., 212 a, 212 b, and a block(s) to prefetch field, e.g.,214 a, 214 b. The branch ID block 212 a, 212 b specifies the one or moreblocks that must be fetched before conditional processing of theprefetch field 214 a, 214 b. With the conditional prefetch statement 202b only one branch is made effective. Once the condition associated withone branch ID 212 a, 212 b is realized, i.e., the block(s) indicated inthe branch ID field 212 a, 212 b are fetched, then an operation isperformed with respect to the blocks indicated in the blocks to prefetchfield 214 a, 214 b associated with the realized branch ID 212 a, 212 b.In certain embodiments, after one condition is satisfied, the processingof the conditional prefetch statement 202 b is complete and no actionswill be taken with respect to the other branch IDs not realized. The endbranch field 216 a, 216 b is a command to end the branch processing andproceed to the end conditional command 218 where the processing of theconditional prefetch statement 202 b ends and any other followingstatements are processed.

FIG. 7 illustrates operations the processor 8 of the storage controller6 performs when executing code in the I/O layer 14 a or some otherprogram component accessible to the processor 8 to process a conditionalstatement 202 b in a prefetch command 200. Upon processing (at block250) a conditional statement 202 b in a prefetch command 200, theprocessor 8 prefetches (at block 252) in all blocks identified in theblocks to prefetch fields 214 a, 214 b and all blocks indicated in thebranch ID block 212 a, 212 b in the conditional statement 202 b.Alternatively, the processor 8 may just prefetch the blocks identifiedin the branch ID blocks 212 a, 212 b. At this point, the conditionalstatement 202 b is active and considered by the processor 8 whenprocessing I/O block requests from the host 2. In alternativeembodiments, the processor 8 may not fetch any of the blocks indicatedin the conditional statement 202 b until one condition of one branch IDblock 212 a, 212 b is satisfied.

Upon receiving (at block 270) a request for one or more blocks from thehost 2, the processor 8 determines (at block 272) whether the requestedblock(s) satisfies a block condition in one branch ID block 212 a, 212 bof one active conditional statement 202 b, where there may be multipleactive conditional statements to consider. If the requested block(s) donot satisfy the condition identified in one branch ID block 212 a, 212 bof one conditional statement 202 b, i.e., do not match the blocksindicated in one branch ID block 212 a, 212 b in one conditionalstatement 202 b, then control returns to block 270 to wait for a nextblock request. Otherwise, if (at block 272) one branch block ID 212 a,212 b is satisfied, then the processor 8 prefetches (at block 274) theblocks indicated in the blocks to prefetch field 214 a, 214 b associatedwith the satisfied branch ID block 212 a, 212 that are not already incache 10. Further, the processor 8 may also remoye (at block 276) fromcache 10 any blocks identified in the blocks to prefetch fields 214 a,214 b associated with other unsatisfied branch ID blocks in theconditional statement. In this way, after the condition of one branch IDblock is satisfied, only the prefetch blocks associated with thatsatisfied branch ID block 212 a, 212 b remain in cache 10 and the blocksassociated with other unsatisfied branch ID blocks are removed if theywere prefetched into cache as a result of this command. The blocks maybe removed as part of normal destaging operations. The conditionalstatement 202 b is then terminated (at block 278) so that it will not beconsidered again.

In certain embodiments, multiple conditional statements may be activeand considered when receiving a request for blocks. Alternatively, thestatements 202 a, 202 b, 202 c in a prefetch command 200 may beprocessed sequentially, where the statement of standard prefetch blocks,e.g., 202 c, following a conditional statement, e.g., 202 b, is notprocessed until the conditional statement ends.

Described embodiments provide techniques to enable conditionalprefetching of data from a storage system based on the current accesseddata or patterns in order to prefetch blocks likely to be requested. Thedetermination of blocks to prefetch may be determined by predictiveanalysis programs, user preference, empirical observations or any othertechnique known in the art.

Additional Embodiment Details

The described embodiments for copying data between controllers may beimplemented as a method, apparatus or article of manufacture usingstandard programming and/or engineering techniques to produce software,firmware, hardware, or any combination thereof. The term “article ofmanufacture” as used herein refers to code or logic implemented inhardware logic (e.g., an integrated circuit chip, Programmable GateArray (PGA), Application Specific Integrated Circuit (ASIC), etc.) or acomputer readable medium, such as magnetic storage medium (e.g., harddisk drives, floppy disks, tape, etc.), optical storage (CD-ROMs,optical disks, etc.), volatile and non-volatile memory devices (e.g.,EEPROMs, ROMs, PROMs, RAMs, DRAMs, SRAMs, firmware, programmable logic,etc.). Code in the computer readable medium is accessed and executed bya processor. The code in which preferred embodiments are implemented mayfurther be accessible through a transmission media or from a file serverover a network. In such cases, the article of manufacture in which thecode is implemented may comprise a transmission media, such as a networktransmission line, wireless transmission media, signals propagatingthrough space, radio waves, infrared signals, etc. Thus, the “article ofmanufacture” may comprise the medium in which the code is embodied.Additionally, the “article of manufacture” may comprise a combination ofhardware and software components in which the code is embodied,processed, and executed. Of course, those skilled in the art willrecognize that many modifications may be made to this configurationwithout departing from the scope of the present invention, and that thearticle of manufacture may comprise any information bearing medium knownin the art.

The described operations may be performed by circuitry, where“circuitry” refers to either hardware or software or a combinationthereof. The circuitry for performing the operations of the describedembodiments may comprise a hardware device, such as an integratedcircuit chip, Programmable Gate Array (PGA), Application SpecificIntegrated Circuit (ASIC), etc. The circuitry may also comprise aprocessor component, such as an integrated circuit, and code in acomputer readable medium, such as memory, wherein the code is executedby the processor to perform the operations of the described embodiments.

In described embodiments, the data blocks subject to the conditionalchecking and prefetching may comprise bytes in storage at logical blockaddresses, tracks, or any other data unit known in the art.

The illustrated operations of FIGS. 3, 4, and 7 show certain eventsoccurring in a certain order. In alternative embodiments, certainoperations may be performed in a different order, modified or removed.Moreover, steps may be added to the above described logic and stillconform to the described embodiments. Further, operations describedherein may occur sequentially or certain operations may be processed inparallel. Yet further, operations may be performed by a singleprocessing unit or by distributed processing units.

The foregoing description of various embodiments of the invention hasbeen presented for the purposes of illustration and description. It isnot intended to be exhaustive or to limit the invention to the preciseform disclosed. Many modifications and variations are possible in lightof the above teaching. It is intended that the scope of the invention belimited not by this detailed description, but rather by the claimsappended hereto. The above specification, examples and data provide acomplete description of the manufacture and use of the composition ofthe invention. Since many embodiments of the invention can be madewithout departing from the spirit and scope of the invention, theinvention resides in the claims hereinafter appended.

1. A method, comprising: processing a prefetch command indicating atleast one conditional statement and at least one block to prefetch fromstorage to cache in response to determining that the conditionalstatement is satisfied.
 2. The method of claim 1, wherein theconditional statement indicates a block that when accessed causes theprefetching of the at least one block to prefetch indicated in theconditional statement, wherein processing the prefetch commandcomprises: generating the prefetch command using predictive analysistechniques to determine blocks anticipated to be accessed if a specifiedblock is accessed, wherein the conditional statements specifies toprefetch the at least one block anticipated to be accessed if thespecified block is accessed.
 3. The method of claim 1, wherein oneconditional statements is satisfied if an Input/Output request isdirected to a specified block in the conditional statement.
 4. Themethod of claim 3, wherein processing the prefetch command comprisesgenerating the prefetch command, further comprising: transmitting thegenerated prefetch command to a storage controller; and transmittingInput/Output (I/O) requests to the storage controller after transmittingthe generated prefetch command, wherein the storage controllerprefetches the at least one block to prefetch indicated in one prefetchcommand in response to determining that the I/O request is directed tothe specified block in the conditional statement of one prefetchcommand.
 5. The method of claim 3, wherein processing the prefetchcommand further comprises: including a duration parameter in theprefetch command indicating a duration of the prefetch command.
 6. Themethod of claim 1, wherein processing the prefetch command comprisesreceiving the prefetch command, further comprising: receiving anInput/Output request directed to a target block; determining whether thetarget block satisfies the conditional statement of one prefetchcommand; and prefetching the at least one block to prefetch indicated inthe conditional statement of one prefetch command into the cache inresponse to determining that the target block satisfies the conditionalstatement of one prefetch command.
 7. The method of claim 6, whereindetermining whether the target block satisfies the conditional statementof one prefetch command comprises determining whether the target blocksatisfies the conditional statement of one unexpired prefetch command.8. The method of claim 1, wherein one conditional statement includes aplurality of branch conditions, wherein each branch condition indicatesone block and is associated with at least one block to prefetch, furthercomprising: prefetching all blocks to prefetch associated with thebranch conditions in the conditional statement; and removing blocks toprefetch from cache associated with branch conditions that are notsatisfied in response to determining that the block indicated in onebranch condition is accessed.
 9. A system, comprising: a cache; storage;and circuitry capable of performing operations, the operationscomprising processing a prefetch command indicating at least oneconditional statement and at least one block to prefetch from thestorage to the cache in response to determining that the conditionalstatement is satisfied.
 10. The system of claim 9, wherein theconditional statement indicates a block that when accessed causes theprefetching of the at least one block to prefetch indicated in theconditional statement, wherein processing the prefetch commandcomprises: generating the prefetch command using predictive analysistechniques to determine blocks anticipated to be accessed if a specifiedblock is accessed, wherein the conditional statements specifies toprefetch the at least one block anticipated to be accessed if thespecified block is accessed.
 11. The system of claim 9, wherein oneconditional statements is satisfied if an Input/Output request isdirected to a specified block in the conditional statement.
 12. Thesystem of claim 11, wherein processing the prefetch command comprisesgenerating the prefetch command, wherein the operations furthercomprise: transmitting the generated prefetch command to a storagecontroller; and transmitting Input/Output (I/O) requests to the storagecontroller after transmitting the generated prefetch command, whereinthe storage controller prefetches the at least one block to prefetchindicated in one prefetch command in response to determining that theI/O request is directed to the specified block in the conditionalstatement of one prefetch command.
 13. The system of claim 11, whereinprocessing the prefetch command further comprises: including a durationparameter in the prefetch command indicating a duration of the prefetchcommand.
 14. The system of claim 9, wherein processing the prefetchcommand comprises receiving the prefetch command, wherein the operationsfurther comprise: receiving an Input/Output request directed to a targetblock; determining whether the target block satisfies the conditionalstatement of one prefetch command; and prefetching the at least oneblock to prefetch indicated in the conditional statement of one prefetchcommand into the cache in response to determining that the target blocksatisfies the conditional statement of one prefetch command.
 15. Thesystem of claim 14, wherein determining whether the target blocksatisfies the conditional statement of one prefetch command comprisesdetermining whether the target block satisfies the conditional statementof one unexpired prefetch command.
 16. The system of claim 9, whereinone conditional statement includes a plurality of branch conditions,wherein each branch condition indicates one block and is associated withat least one block to prefetch, wherein the operations further comprise:prefetching all blocks to prefetch associated with the branch conditionsin the conditional statement; and removing blocks to prefetch from cacheassociated with branch conditions that are not satisfied in response todetermining that the block indicated in one branch condition isaccessed.
 17. An article of manufacture capable of causing operations tobe performed, the operations comprising: processing a prefetch commandindicating at least one conditional statement and at least one block toprefetch from storage to cache in response to determining that theconditional statement is satisfied.
 18. The article of manufacture ofclaim 17, wherein the conditional statement indicates a block that whenaccessed causes the prefetching of the at least one block to prefetchindicated in the conditional statement, wherein processing the prefetchcommand comprises: generating the prefetch command using predictiveanalysis techniques to determine blocks anticipated to be accessed if aspecified block is accessed, wherein the conditional statementsspecifies to prefetch the at least one block anticipated to be accessedif the specified block is accessed.
 19. The article of manufacture ofclaim 17, wherein one conditional statements is satisfied if anInput/Output request is directed to a specified block in the conditionalstatement.
 20. The article of manufacture of claim 19, whereinprocessing the prefetch command comprises generating the prefetchcommand, wherein the operations further comprise: transmitting thegenerated prefetch command to a storage controller; and transmittingInput/Output (I/O) requests to the storage controller after transmittingthe generated prefetch command, wherein the storage controllerprefetches the at least one block to prefetch indicated in one prefetchcommand in response to determining that the I/O request is directed tothe specified block in the conditional statement of one prefetchcommand.
 21. The article of manufacture of claim 19, wherein processingthe prefetch command further comprises: including a duration parameterin the prefetch command indicating a duration of the prefetch command.22. The article of manufacture of claim 17, wherein processing theprefetch command comprises receiving the prefetch command, and whereinthe operations further comprise: receiving an Input/Output requestdirected to a target block; determining whether the target blocksatisfies the conditional statement of one prefetch command; andprefetching the at least one block to prefetch indicated in theconditional statement of one prefetch command into the cache in responseto determining that the target block satisfies the conditional statementof one prefetch command.
 23. The article of manufacture of claim 22,wherein determining whether the target block satisfies the conditionalstatement of one prefetch command comprises determining whether thetarget block satisfies the conditional statement of one unexpiredprefetch command.
 24. The article of manufacture of claim 17, whereinone conditional statement includes a plurality of branch conditions,wherein each branch condition indicates one block and is associated withat least one block to prefetch, wherein the operations further comprise:prefetching all blocks to prefetch associated with the branch conditionsin the conditional statement; and removing blocks to prefetch from cacheassociated with branch conditions that are not satisfied in response todetermining that the block indicated in one branch condition isaccessed.